#version 460 core

layout(location = 0) in vec3 position;
layout(location = 1) in vec3 color;
layout(location = 2) in vec3 normal;
layout(location = 3) in vec2 uv;

layout(location = 0) out vec3 worldPos;
layout(location = 1) out vec3 normalWorldSpace;

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;
uniform mat4 normalMatrix;

void main() {
    vec3 lightColor = vec3(0.6, 0.6, 0.6);
    // 计算世界空间中的顶点坐标
    worldPos = vec3(modelMatrix * vec4(position, 1.0));
    // 计算世界空间中的法线
    normalWorldSpace = normalize(mat3(normalMatrix) * normal);

    gl_Position = projectionMatrix * viewMatrix * vec4(worldPos, 1.0);
}
